import { Controller, HttpStatus, Put, Query, Req } from '@nestjs/common';
import { ApiHeader, ApiResponse, ApiTags } from '@nestjs/swagger';
import { Request } from 'express';
import { ValidAuthFailDto } from 'src/user/dto/middleware/auth.middleware.dto';
import { AwardService } from './award.service';
import {
  GetAwardItemReqDto,
  GetAwardItemResFailDto,
  GetAwardItemResSuccessDto,
} from './dto/get-awarditem.dto';

@ApiTags('award')
@ApiResponse({
  status: HttpStatus.FORBIDDEN,
  type: ValidAuthFailDto,
  description: '身份验证失败',
})
@Controller('award')
export class AwardController {
  constructor(private readonly awardService: AwardService) {}

  @Put('award-item')
  @ApiHeader({
    name: 'token',
    description: '身份令牌',
  })
  @ApiResponse({
    status: HttpStatus.CREATED,
    type: GetAwardItemResSuccessDto,
    description: '获取奖励成功',
  })
  @ApiResponse({
    status: HttpStatus.ACCEPTED,
    type: GetAwardItemResFailDto,
    description: '获取奖励失败',
  })
  async getAwardItem(
    @Req() request: Request,
    @Query() query: GetAwardItemReqDto,
  ) {
    const openid = request['user'].openid;
    return {
      success: true,
      // award: awardItem,
    };
  }
}
